<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* .t1 {
            width: 300px;
            height: 300px;
            border: 1px solid red;
            position: relative;
        }

        .t2 {
            width: 200px;
            height: 200px;
            border: 1px solid blue;
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
        } */

        /* display:table-cell  vertical-align:middle */
        /* .t1 {
            width: 300px;
            height: 300px;
            border: 1px solid red;
            display: table-cell;
            vertical-align: middle;
        }

        .t2 {
            width: 200px;
            height: 200px;
            border: 1px solid blue;
        } */


        .t1 {
            width: 300px;
            height: 300px;
            border: 1px solid red;
            display: flex;
            align-items: center;
        }

        .t2 {
            width: 200px;
            height: 200px;
            border: 1px solid blue;
        }
    </style>
</head>

<body>
    <div class="t1">
        <div class="t2"></div>
    </div>
</body>

</html>